﻿#pragma once
#ifndef DataTypeDef_hpp
#define DataTypeDef_hpp


#include<stdint.h>
#include<mutex>

namespace MMF
{


    enum class MMFDataType 
    {

        //错误
        ERR = -1,

        //流数据
        STEAM = 0,

        //基本数据类型标记
        INT8 = 1,
        UINT8 = 2,
        INT16 = 3,
        UINT16 = 4,
        INT32 = 5,
        UINT32 = 6,
        INT64 = 7,
        UINT64 = 8,
        FLOAT32 = 9,
        FLOAT64 = 10,


        //复合数据类型标记
        CPX_INT16 = 10000,
        CPX_UINT16 = 10001,
        CPX_INT32 = 10002,
        CPX_UINT32 = 10003,
        CPX_INT64 = 10004,
        CPX_UINT64 = 10005,
        CPX_FLOAT32 = 10006,
        CPX_FLOAT64 = 10007,


        //GPU上的数据类型
        GPU_INT16 = 20000,
        GPU_UINT16 = 20001,
        GPU_INT32 = 20002,
        GPU_UINT32 = 20003,
        GPU_INT64 = 20004,
        GPU_UINT64 = 20005,
        GPU_FLOAT32 = 20006,
        GPU_FLOAT64 = 20007,


        GPU_CPX_INT16 = 30000,
        GPU_CPX_UINT16 = 30001,
        GPU_CPX_INT32 = 30002,
        GPU_CPX_UINT32 = 30003,
        GPU_CPX_INT64 = 30004,
        GPU_CPX_UINT64 = 30005,
        GPU_CPX_FLOAT32 = 30006,
        GPU_CPX_FLOAT64 = 30007,
    };


    /***
     * 数据传输过程buffer
    */
    struct MMFDataBuffer
    {
        MMFDataType mType;          ///< 数据类型
        void* mDataAddr;            ///< 数据地址，请注意这里可能会在GPU,也可能会在CPU
        uint64_t mNumber;           ///< 数据量
        uint64_t mOffset;           ///< 数据偏移
    };


    /***
     * 上下文
    */
    struct MMFCtx 
    {        
        void* mGpuCtx;              ///< gpu上下文
        void* mGpuQueue;            ///< gpu队列
    };


    /***
     * 设备上下文
     * 此为基类用于集成和实现框架
    */
    struct MMFDeviceCfgBase{};


    /***
        * 句柄数据类型
    */
    using Handle = void*;


    /**
     * 复数类型定义
    */
    template<typename T>
    struct Complex
    {
        T mReal;
        T mImag;
    };


    /**
     * 点
    */
    template<typename T>
    struct Point
    {
        T x;
        T y;
    };
}

#endif